package com.itheima.spec.controller;

import com.itheima.spec.mapper.SpecMapper;
import com.itheima.spec.service.SpecService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张伟奇
 * @Date 2021/7/11 10:24
 * @description
 * @Version 1.0
 **/
@RestController
@RequestMapping("/spec")
@CrossOrigin
public class SpecController {
    @Autowired
    private SpecService specService;

    @GetMapping("/search/{currentPage}/{pageSize}")
    public Result findSpecByPage(@PathVariable("currentPage") Integer currentPage,
                                 @PathVariable("pageSize") Integer pageSize){

        PageResult specByPage = specService.findSpecByPage(currentPage, pageSize);
        return new Result(true, StatusCode.OK,"查询成功",specByPage);
    }
}
